<?php require_once LAYOUTPATH.'layout_header.php'; ?>

<h1>Hello! Log in or sign up for a new <img style="vertical-align: baseline; margin-bottom: -1px;" src="/assets/images/bricabox_id_big.png" alt="BricaBox ID" /></h1>
<h2 class="back_to">
<?php if (isset($back_to) && $back_to !== false): ?>
You'll be taken back to <strong><?php echo $back_to->name; ?></strong> once you sign up or log in.
<?php endif; ?>
Need help? <a href="/about/contact">Contact us.</a>
</h2>

<?php require_once FLASHPARTIAL; ?>

<?php if (strlen(@$this->validation->error_string)): ?>
<h5 class="alert error"><?php echo str_replace('The Terms of Service field must have a value.', 'You must agree to the Terms of Service.', @$this->validation->error_string); ?></h5>
<?php endif; ?>

<div class="three_col">
	<div class="third">
		<h2 id="login_login">Log in</h2>
		<form action="/account/auth/<?php echo $token; ?>" method="post">
			<fieldset>
				<div>
					<label for="login">BricaBox ID:</label><br />
					<input type="text" id="login" name="login" value="<?php if (isset($login)) echo $login; ?>" />
				</div>

				<div>
					<label for="password">Password:</label><br />
					<input type="password" id="password" name="password" value="" />
				</div>

				<div class="controls">
					<input type="submit" value="Log in" />
					<a href="/account/recover_password">Forgot your password?</a>
				</div>
				
				<div class="bricabox_id">
					<img src="/assets/images/bricabox_id.png" alt="BricaBox ID" />
					<p>What's a BricaBox ID? <a href="#">Find out here</a>.</p>
				</div>
			</fieldset>
		</form>
	</div>
	
	<div class="third">
		<h2 id="login_signup">Sign up</h2>
		<form action="/account/create_account/<?php echo $token; ?>" method="post">
			<fieldset>
				<div>
					<label for="new_login">Choose your BricaBox ID:</label><br />
					<input type="text" id="new_login" name="login" value="<?php if (isset($login)) echo $login; if (strlen(@$this->validation->login)) echo $this->validation->login; ?>" />
				</div>
				
				<div>
					<label for="email">Email address:</label><br />
					<input type="text" id="email" name="email" value="<?php echo @$this->validation->email; ?>" />
				</div>

				<div>
					<label for="new_password">Password:</label><br />
					<input type="password" id="new_password" name="password" value="" />
				</div>
				
				<div>
					<label for="confirm_password">Confirm your password:</label><br />
					<input type="password" id="confirm_password" name="confirm_password" value="" />
				</div>
				
				<div>
					<?php echo $cap['image']; ?><br />
					<label for="captcha">Type the text you see above (<a href="http://en.wikipedia.org/wiki/Case_sensitive" target="_blank">NOT case sensitive</a>):</label><br />
					<input type="text" id="captcha" name="captcha" value="<?php echo @$this->validation->captcha; ?>" />
					<input type="hidden" name="captcha_val" value="<?php echo md5($cap['word']); ?>" />
				</div>
				
				<div>
					<input type="checkbox" value="1" name="tos" id="terms" />
					<label for="terms">I agree to the <a href="/about/terms">Terms of Service</a></label>
				</div>

				<div class="controls">
					<input type="submit" value="Create my account!" />
				</div>
			</fieldset>
		</form>
	</div>
	
	<div class="third">
		<h2 id="login_openid">Use OpenID</h2>
		<form action="/account/auth_openid/<?php echo $token; ?>" method="post">
			<fieldset>
				<div>
					<label for="openid" class="openid">Your <a href="http://openid.net/what/" target="_blank">OpenID</a> URL:</label><br />
					<input type="text" id="openid" name="openid" value="<?php if (isset($openid)) echo $openid; ?>" />
				</div>
				<div>
					<label for="openid">By using OpenID, you agree to our&nbsp;<a href="/about/terms">Terms&nbsp;of&nbsp;Service</a></label>
				</div>
				<div class="controls">
					<input type="submit" value="Authenticate using OpenID" />
				</div>
			</fieldset>
		</form>
	</div>
</div>

<?php require_once LAYOUTPATH.'layout_footer.php'; ?>